<template>
	<view>
		<view class="cu-custom" :style="[{height:navBgImageHeight + 'px'}]">
			<image class="header-bg" :src="showBackground">
			</image>
			<view class="cu-bar fixed"
				:style="'height:'+navHeight+'px;padding-top:'+statusHeight+'px;opacity:'+searchOpacity+';'">
				<view @tap="jumpToSearchAction" class="flex justify-center align-center"
					style="z-index: 99;position: absolute;left: 50upx;width: 44upx;height: 44upx;">
					<image src="../../static/images/setting/search.png" style="width: 100%;height: 100%;"></image>
				</view>
			</view>
			<view :class="'cu-bar fixed '+themeColor"
				:style="'width:100%;height:'+navHeight+'px;padding-top:'+statusHeight+'px;opacity:'+navOpacity+';'">
				<view @tap="jumpToSearchAction" class="flex justify-center align-center"
					style="width: 44upx;height: 44upx;">
					<image src="../../static/images/setting/search.png" style="left: 50upx;width: 100%;height: 100%;">
					</image>
				</view>
				<view v-if="isUserLogin" class="flex justify-center align-center" style="width:100%;">
					<view class="cu-avatar round padding-right-sm" :style="'background-image: url('+showAvatar+');'">
					</view>
					<text class="padding-left-sm text-white">{{showNickname}}</text>
					<view v-if="userInfo&&userInfo.role_id>0" class="padding-left-xs">
						<view class="radius cu-tag bg-orange sm">{{userInfo.role.name}}</view>
					</view>
				</view>
			</view>
		</view>
		<view v-if="isUserLogin==false" class="bg-gray">
			<view class="flex justify-center align-center" style="flex-direction: column;height: 10vh;">
				<view class="flex justify-center align-center" style="width: 100%;">
					<button @tap="loginNowAction" class="cu-btn bg-green radius" style="width: 40%;">立即登录</button>
				</view>
			</view>
		</view>
		<view v-if="isUserLogin" class="info-card">
			<view class="avatar">
				<image class="avatar-img" :src="userInfo.avatar"></image>
				<image v-if="userInfo.sex!==-1" class="sex-icon bg-white round"
					:src="'../../static/images/setting/'+[userInfo.sex==0?'female':'male']+'.png'"></image>
			</view>
			<view class="name-box">
				<view class="flex justify-start align-start margin-left-xs" style="width: 100%;flex-direction: column;">
					<view class="flex justify-start align-center" style="width: 100%;">
						<text class="text-bold text-lg">{{userInfo.nickname}}</text>
						<view v-if="userInfo.group!==null" class="flex justify-start align-center padding-left-xs">
							<view class="radius cu-tag sm bg-gray text-grey">{{userInfo.group.name}}</view>
						</view>
						<view v-if="userInfo.role!==null" class="padding-left-xs">
							<view style="max-width: 65upx;" :class="'radius cu-tag sm bg-'+roleColor">
								{{userInfo.role.name}}
							</view>
						</view>
					</view>
					<view class="flex justify-between align-end" style="width: 100%;">
						<text class="text-gray">{{showJoinDate}}</text>
						<view class="flex justify-end align-center padding-right-sm" style="width: 60%;">
							<view style="width: 8px;"></view>
							<button @tap="editProfileAction" class="cu-btn bg-blue round sm" style="width: 55%;"><text
									class="cuIcon-edit"></text>编辑资料</button>
						</view>
					</view>
				</view>
			</view>
			<view class="bottom-box">
				<view
					class="flex justify-between align-center solid-bottom padding-top-sm padding-bottom-sm padding-right-sm"
					style="width: 100%;">
					<view class="flex justify-start align-center">
						<text class="text-df">{{userInfo.area}}-{{userInfo.country}}</text>
						<view style="width: 40upx;"></view>
						<button v-if="userInfo.sign_status==null" @tap="chooseSignStatus" class="cu-btn line-cyan sm round"
							style="min-width: 120upx;transform: scale(0.95);font-size: 24upx;"><text
								class="cuIcon-add">状态</text></button>
						<view @tap="chooseSignStatus" v-else class="line-cyan flex justify-start align-center padding-xs">
							<image src="../../static/images/setting/sign_status.png" style="width: 30upx;height: 30upx;"></image>
							<view style="width: 4upx;"></view>
							<text class="text-cyan">{{userInfo.sign_status}}</text>
						</view>
					</view>
					<view class="flex justify-end align-center">
						<text @tap="showScoreIntroduce" class="cuIcon-question text-gray padding-right-sm"></text>
						<text class="text-xl text-bold">{{userInfo.score}}<text
								class="text-df count-tag-color tag-name">山竹</text></text>
					</view>
				</view>
				<view v-if="isUserLogin&&userInfo"
					class="flex justify-between align-center padding-top padding-bottom padding-right-sm solid-bottom"
					style="width: 100%;">
					<text class="text-xl text-bold">{{format(userInfo.active_count)}}<text
							class="text-df count-tag-color tag-name">动态</text></text>
					<text class="text-xl text-bold">{{format(userInfo.post_count)}}<text
							class="text-df count-tag-color tag-name">帖子</text></text>
					<text class="text-xl text-bold">{{format(userInfo.fans_count)}}<text
							class="text-df count-tag-color tag-name">粉丝</text></text>
					<text class="text-xl text-bold">{{format(userInfo.attention_count)}}<text
							class="text-df count-tag-color tag-name">关注</text></text>
				</view>
				<view class="flex justify-start align-start padding-top-sm padding-bottom padding-right-sm"
					style="flex-direction: column;width: 100%;">
					<view class="flex justify-between align-center padding-bottom-sm" style="width: 100%;">
						<text class="text-df">我的标签</text>
						<text v-if="userInfo.hobby_label.length>4" class="text-gray">滑动查看</text>
					</view>
					<scroll-view v-if="userInfo.hobby_label.length > 0" scroll-x="true"
						style="white-space: nowrap;overflow: hidden;">
						<view v-for="(item,index) in userInfo.hobby_label" :key="index" style="display: inline-block;">
							<view v-if="index%2==0" class="padding-right">
								<view class="cu-tag line-orange round">
									{{item}}
								</view>
							</view>
							<view v-else class="padding-right">
								<view class="cu-tag bg-orange round">
									{{item}}
								</view>
							</view>
						</view>
					</scroll-view>
					<button v-else style="transform: scale(0.9);" @tap="chooseHobbyLabelDirect" class="bg-orange radius cu-btn">去选择我的标签</button>
				</view>
			</view>
		</view>
		<view v-if="isUserLogin" style="height: 300upx;"></view>
		<view v-if="isUserLogin" style="height: 15px;"></view>
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" :up="upOption">
			<view class="flex justify-start align-start padding-bottom bg-white"
				style="flex-direction: column;width: 100%;">
				<view class="flex justify-between align-center padding-left padding-right padding-bottom padding-top-sm"
					style="width: 100%;">
					<text class="text-df text-lg text-bold">我的服务</text>
				</view>
				<view class="flex justify-start align-start padding-left padding-right"
					style="flex-direction: column;width: 100%;">
					<view class="flex justify-between align-center margin-bottom" style="width: 100%;">
						<view v-for="(item,index) in menuList[0]" :key="index">
							<view @tap="jumpToPage(item.path)" class="flex justify-center align-center"
								style="flex-direction: column;">
								<image :src="'../../static/images/setting/'+item.icon+'.png'"
									style="width: 20px;height: 20px;"></image>
								<view style="height: 2px;"></view>
								<text>{{item.title}}</text>
							</view>
						</view>
					</view>
					<view class="flex justify-between align-center" style="width: 100%;">
						<view v-for="(item,index) in menuList[1]" :key="index">
							<view @tap="jumpToPage(item.path)" class="flex justify-center align-center"
								style="flex-direction: column;">
								<image :src="'../../static/images/setting/'+item.icon+'.png'"
									style="width: 20px;height: 20px;"></image>
								<view style="height: 2px;"></view>
								<text>{{item.title}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view v-if="userInfo.role_id > 0">
				<view style="height: 15px;" class="bg-gray"></view>
				<view class="bg-white padding">
					<view @tap="jumpToAdminPanel" class="justify-between flex align-center">
						<text class="text-lg">进入管理台</text>
						<view class="flex justify-end align-center">
							<view v-if="adminUnreadInfo&&adminUnreadInfo.total>0" class="unread-badge bg-red">
								{{adminUnreadInfo.total}}
							</view>
							<text
								:class="'cuIcon-right text-grey '+[adminUnreadInfo&&adminUnreadInfo.total>0?'padding-left':'']"></text>
						</view>
					</view>
				</view>
			</view>
			<view style="height: 15px;" class="bg-gray">
			</view>
			<view @tap="jumpToSetting" class="bg-white padding solid-bottom action">
				<view class="justify-between flex align-center">
					<text class="text-lg">系统设置</text>
					<text class="cuIcon-right text-grey"></text>
				</view>
			</view>
			<view @tap="jumpToAdvice" class="bg-white padding solid-bottom action">
				<view class="justify-between flex align-center">
					<text class="text-lg">投诉与建议</text>
					<text class="cuIcon-right text-grey"></text>
				</view>
			</view>
			<view @tap="jumpToContactUs" class="bg-white padding solid-bottom action">
				<view class="justify-between flex align-center">
					<text class="text-lg">联系我们</text>
					<text class="cuIcon-right text-grey"></text>
				</view>
			</view>
			<view @tap="jumpToAbout" class="bg-white padding">
				<view class="justify-between flex align-center">
					<text class="text-lg">关于{{appName}}</text>
					<text class="cuIcon-right text-grey"></text>
				</view>
			</view>
		</mescroll-body>
		<view style="height: 50px;" class="bg-gray"></view>
		<tui-bottom-popup :show="bottomPopup" :radius="true" @close="hideModal" style="z-index: 9999;">
			<view class="flex justify-between align-center solid-bottom padding-left padding-right padding-top-sm padding-bottom-sm">
				<text @tap="hideModal" class="text-gray">取消</text>
				<text class="title">选择你的状态</text>
				<text @tap="confirmChooseSignStatus" class="text-blue">确定</text>
			</view>
			<view class="flex justify-start" style="flex-wrap: wrap;padding-bottom: 130upx;">
				<view class="padding-left padding-right-sm padding-top-sm padding-bottom-sm" v-for="(item,index) in allSignStatus" :key="index">
					<view @tap="tapChooseStatus(item)" :class="'cu-tag round '+[selectStatus==item?'bg-cyan':'line-cyan']">{{item}}</view>
				</view>
			</view>
		</tui-bottom-popup>
		<view class="cu-tabbar-height"></view>
		<publish-choose ref="publishChoose" class="publish-choose"></publish-choose>
		<tabbar @publish="publishClicked" :tabCur="4" :unreadMsgCount="unread" :unreadCount="tabUnreadCount"></tabbar>
	</view>
</template>

<script>
	import PublishChoose from '@/components/publish-choose.vue'
	import {
		getTagColorForRole,
		cutDateFromDateTime,
		checkUserSubscribeMessageStatus,
		formatCount
	} from '@/api/utils.js'
	import {
		checkLogin
	} from '@/js_sdk/checkLogin.js'
	import {
		isLogin,
		getUserInfo,
		setUserInfo,
		getToken
	} from '@/api/auth.js'
	import {
		getUserInfoDetail,
		userUnreadCountInfo,
		markMiniProgramUsed,
		getShopDetail,
		daySign,
		getAdminUnreadCountInfo,
		getAllSignStatus,
		updateUserInfo
	} from '@/api/api.js'
	import {
		getDraft
	} from '@/api/statusCache.js'
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
	import tabbar from '@/components/tabbar.vue'
	import config from '@/api/config.js'
	export default {
		mixins: [MescrollMixin],
		name: "My",
		components: {
			tabbar,
			PublishChoose
		},
		data() {
			return {
				appName:config.appName,
				selectStatus:null,
				bottomPopup: false,
				allSignStatus: [],
				unreadMsgCount: 0,
				orderMenuList:[{
							icon: 'p-wait-pay',
							title: '待支付',
							path: '/pages/always/order-list/order-list?tab=0'
						},
						{
							icon: 'p-wait-delivery',
							title: '待发货',
							path: '/pages/always/order-list/order-list?tab=1'
						},
						{
							icon: 'p-delivery',
							title: '已发货',
							path: '/pages/always/order-list/order-list?tab=2'
						},
						{
							icon: 'p-complete',
							title: '已完成',
							path: '/pages/always/order-list/order-list?tab=3'
						}
					],
				menuList: [
					[{
							icon: 'p-active',
							title: '我的动态',
							path: '/pages/lessuse/active-list/active-list?mode=my'
						},
						{
							icon: 'p-post',
							title: '我的帖子',
							path: '/pages/always/user-post/user-post'
						},
						{
							icon: 'p-comment',
							title: '我的评论',
							path: '/pages/always/user-comment/user-comment'
						},
						{
							icon: 'p-circle',
							title: '我的圈子',
							path: '/pages/lessuse/circle-list/circle-list?mode=my'
						}
					],
					[{
							icon: 'p-favorite',
							title: '我的收藏',
							path: '/pages/always/user-post/user-post?isFav=1'
						},
						{
							icon: 'p-fans',
							title: '我的粉丝',
							path: '/pages/lessuse/fans-list/fans-list?mode=3'
						},
						{
							icon: 'p-attention',
							title: '我的关注',
							path: '/pages/lessuse/fans-list/fans-list?mode=1'
						},
						{
							icon: 'p-active-fav',
							title: '收藏动态',
							path: '/pages/lessuse/active-list/active-list?mode=my_fav'
						}
					]
				],
				adminUnreadInfo: null,
				unreadPostPraiseCount: 0,
				searchTop: 80,
				themeColor: this.ThemeColor,
				hasShop: false,
				isLoadingUserInfo: false,
				isUserLogin: false,
				windowWidth: 320,
				windowHeight: 568,
				userInfo: null,
				top: 0, //标题图标距离顶部距离
				opacity: 0.5,
				scrollTop: 0.5,
				upOption: {
					use: false,
					page: {
						size: 10 // 每页数据的数量,默认10
					},
					textNoMore: '-- 码动未来信息科技:(微信)13177627765 --',
					noMoreSize: 1, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
					empty: {
						tip: '暂无相关数据'
					}
				}
			}
		},
		created() {
			uni.hideTabBar()
		},
		onShow() {
			this.isUserLogin = isLogin()
			this.initAdminUnreadCountInfo()
			if (this.isUserLogin) {
				userUnreadCountInfo().then(res => {
					this.unreadMsgCount = res.data.total
				})
			}
		},
		onLoad(options) {
			this.checkHasShop()
			this.themeColor = this.ThemeColor
			this.isUserLogin = isLogin()
			if (isLogin()) {
				this.initUserInfo()
				this.userInfo = getUserInfo()
				console.log('load user info:' + JSON.stringify(this.userInfo))
			}
			let that = this
			uni.$on('UserInfoNeedUpdate', function(data) {
				that.initUserInfo()
			})
			uni.$on('UserLoginSuccess', function(data) {
				that.isUserLogin = true
				that.initUserInfo()
			})
			let _this = this
			uni.getSystemInfo({
				success(res) {
					console.log('window info:' + JSON.stringify(res))
					_this.windowWidth = res.windowWidth
					_this.windowHeight = res.windowHeight
					_this.searchTop = (res.windowWidth / 320) * _this.searchTop
					_this.StatusBar = res.statusBarHeight
					// #ifdef MP-QQ || MP-WEIXIN
					let custom = wx.getMenuButtonBoundingClientRect();
					_this.CustomBar = custom.bottom + custom.top - res.statusBarHeight;
					// #endif
					// #ifdef MP-BAIDU
					let custom = swan.getMenuButtonBoundingClientRect();
					_this.CustomBar = custom.bottom + custom.top - res.statusBarHeight;
					// #endif
				}
			})
			getAllSignStatus().then(res => {
				this.allSignStatus = res.data
			}).catch(error => {

			})
		},
		computed: {
			tabUnreadCount() {
				if (this.adminUnreadInfo == null) {
					return 0
				}
				return this.adminUnreadInfo.total
			},
			score() {
				if (this.userInfo == null) {
					return 0
				}
				if (this.userInfo.score > 1000) {
					return (this.userInfo.score / 1000).toFixed(1) + 'k'
				}
				if (this.userInfo.score > 10000) {
					return (this.userInfo.score / 10000).toFixed(1) + 'w'
				}
				return this.userInfo.score
			},
			scoreName() {
				return config.scoreName
			},
			searchOpacity() {
				return 1 - this.navOpacity
			},
			openPriviateMessage() {
				return config.privateMessageOpen == 1 ? true : false
			},
			appName() {
				return config.appName
			},
			showJoinDate() {
				if (this.userInfo == null) {
					return ''
				}
				return cutDateFromDateTime(this.userInfo.created_at)
			},
			roleColor() {
				if (this.userInfo == null ||
					this.userInfo.role == null) {
					return 'white'
				}
				return getTagColorForRole(this.userInfo.role.role_id)
			},
			hasUpdateInfo() {
				return this.userInfo !== null && this.userInfo.user_update_id !== null && this.userInfo.update_info !==
					null
			},
			showDefault() {
				return this.userInfo == null
			},
			showBackground() {
				if (this.showDefault) {
					return config.defaultBackground
				}
				if (this.showUpdateInfoBackground) {
					return this.userInfo.update_info.background
				}
				return this.userInfo.background
			},
			showAvatar() {
				if (this.showDefault) {
					return 'https://cdn.icodefuture.com/1618912738538'
				}
				if (this.showUpdateAvatar) {
					return this.userInfo.update_info.avatar
				}
				return this.userInfo.avatar
			},
			showNickname() {
				if (this.showDefault) {
					return '生如夏花0'
				}
				if (this.showUpdateNickname) {
					return this.userInfo.update_info.nickname
				}
				return this.userInfo.nickname
			},
			showUpdateAvatar() {
				if (!this.hasUpdateInfo) {
					return false
				}
				return this.userInfo.update_info.avatar !== null && this.userInfo.update_info.avatar.length > 0
			},
			showUpdateNickname() {
				if (this.userInfo == null || !this.hasUpdateInfo) {
					return false
				}
				return this.userInfo.update_info.nickname !== null && this.userInfo.update_info.nickname.length > 0
			},
			showUpdateInfoBackground() {
				if (this.userInfo == null || !this.hasUpdateInfo) {
					return false
				}
				return this.userInfo.update_info.background !== null && this.userInfo.update_info.background.length > 0
			},
			navBgImage() {
				return 'https://static.lulingshuo.icodefuture.com/1618910351949'
			},
			navBgImageHeight() {
				return this.windowWidth * 0.8;
			},
			navHeight() {
				return this.CustomBar
			},
			statusHeight() {
				return this.StatusBar
			},
			navOpacity() {
				return this.scrollTop / (this.CustomBar + 140)
			},
			navBgFilter() {
				let scrollRate = Math.min(1, this.scrollTop / (this.CustomBar + 50))
				return (1 - scrollRate) * 2
			}
		},
		onHide() {
			this.$refs.publishChoose.hiddenTabbar()
		},
		onPageScroll(res) {
			this.scrollTop = res.scrollTop
			this.$refs.publishChoose.hiddenTabbar()
		},
		methods: {
			showScoreIntroduce() 
			{
				uni.showModal({
					title:'山竹说明',
					content:'山竹的拥有数代表你在'+this.appName+'的影响力，积极参与社区文化构建，可以不断获取更多的山竹',
					confirmText:'继续努力'
				})
			},
			tapChooseStatus(item)  
			{
				this.selectStatus = item
			},
			confirmChooseSignStatus() 
			{
				if(this.selectStatus == this.userInfo.sign_status) {
					uni.showToast({
						icon:'none',
						title:'状态没有变化哦~'
					})
					this.bottomPopup = false
					return
				}
				if(this.selectStatus == null || this.selectStatus.length == 0) {
					uni.showToast({
						icon:'none',
						title:'请选择状态'
					})
					return
				}
				uni.showLoading({
					title:'正在提交...'
				})
				let params = {
					'signStatus':this.selectStatus
				}
				updateUserInfo(params).then(res=>{
					uni.hideLoading()
					uni.navigateBack({
						delta:1
					})
					uni.showToast({
						title:'更新成功',
					})
					this.bottomPopup = false
					uni.$emit('UserInfoNeedUpdate')
				}).catch(error=>{
					uni.hideLoading()
				})
			},
			hideModal: function() {
				this.bottomPopup = false
			},
			chooseSignStatus() {
				this.bottomPopup = true
			},
			loginNowAction() {
				checkLogin()
			},
			format(count) {
				return formatCount(count)
			},
			chooseHobbyLabelDirect() {
				uni.navigateTo({
					url: '/pages/lessuse/hobby-label-choose/hobby-label-choose?isDirect=1',
				})
			},
			jumpToPage(path) {
				if (isLogin() == false) {
					checkLogin()
					return
				}
				uni.navigateTo({
					url: path
				})
			},
			publishClicked() {
				this.$refs.publishChoose.switchStatus()
			},
			initAdminUnreadCountInfo() {
				let userInfo = getUserInfo()
				if (userInfo.role && userInfo.role_id > 0) {
					getAdminUnreadCountInfo().then(res => {
						this.adminUnreadInfo = res.data
					}).catch(error => {

					})
				}
			},
			chooseUserGroupAction() {
				uni.navigateTo({
					url: '/pages/always/edit-profile/edit-profile?userId=' + this.userInfo.user_id
				})
			},
			jumpToScoreDetail() {
				uni.navigateTo({
					url: '/pages/lessuse/score-introduce/score-introduce'
				})
			},
			daySignAction() {
				checkUserSubscribeMessageStatus()
				return
				uni.showLoading({
					title: '正在签到...'
				})
				daySign().then(res => {
					this.userInfo.day_sign = 1
					uni.showToast({
						title: '签到成功!'
					})
				}).catch(error => {

				})
			},
			jumpToContactUs() {
				uni.navigateTo({
					url: '/pages/lessuse/contact-us/contact-us'
				})
			},
			jumpToSearchAction() {
				uni.navigateTo({
					url: '/pages/lessuse/search/search'
				})
			},
			jumpToMyFansList() {
				uni.navigateTo({
					url: '/pages/lessuse/fans-list/fans-list?mode=3'
				})
			},
			jumpToAttentionList() {
				uni.navigateTo({
					url: '/pages/always/user-attention-list/user-attention-list'
				})
			},
			jumpToMyVoucherList() {
				if (this.isUserLogin == false) {
					checkLogin()
					return
				}
				uni.navigateTo({
					url: '/pages/always/subscribe-voucher-list/subscribe-voucher-list'
				})
			},
			checkHasShop() {
				// #ifndef MP-WEIXIN
				this.hasShop = false
				return
				// #endif
				if (config.selfMallOpen == 0) {
					this.hasShop = false
					return
				}
				getShopDetail(1).then(res => {
					if (res.data.status == 1) {
						this.hasShop = true
					} else {
						this.hasShop = false
					}
				})
			},
			jumpToMyShop() {
				uni.navigateTo({
					url: '/pages/always/create-order/create-order?shopId=1'
				})
			},
			jumpToMyOrderList() {
				uni.navigateTo({
					url: '/pages/always/order-list/order-list'
				})
			},
			jumpToPublishDraft() {
				let draft = getDraft()
				if (draft == null || draft == undefined || draft == "") {
					uni.showModal({
						title: '读取提示',
						content: '您暂无草稿可编辑!',
						confirmText: '知道了'
					})
					return
				}
				uni.navigateTo({
					url: '/pages/publish/publish?fromDraft=1'
				})
			},
			jumpToMySubscribeList() {
				if (this.isUserLogin == false) {
					checkLogin()
					return
				}
				uni.navigateTo({
					url: '/pages/always/forum-list/forum-list?isMy=1'
				})
			},
			jumpToSubscribeList() {
				uni.navigateTo({
					url: '/pages/always/forum-list/forum-list'
				})
			},
			jumpToMiniProgram(item) {
				uni.navigateToMiniProgram({
					appId: item.app_id,
					path: item.index_path,
					success(res) {
						// 打开成功
						console.log('open mini success!');
					}
				})
				markMiniProgramUsed(item.program_id).then(res => {
					console.log('标记小程序使用记录成功:' + item.program_id);
				}).catch(error => {
					console.log('标记小程序使用记录失败:' + item.program_id);
				})
			},
			jumpToPraiseList() {
				uni.navigateTo({
					url: '/pages/always/comment-praise-list/comment-praise-list?postPraiseCount=' + this
						.unreadPostPraiseCount
				})
			},
			jumpToAbout() {
				uni.navigateTo({
					url: '/pages/lessuse/about/about'
				})
			},
			jumpToAdvice() {
				if (this.isUserLogin == false) {
					checkLogin()
					return
				}
				uni.navigateTo({
					url: '/pages/lessuse/advice/advice'
				})
			},
			jumpToSetting() {
				if (this.isUserLogin == false) {
					checkLogin()
					return
				}
				uni.navigateTo({
					url: '/pages/lessuse/setting/setting'
				})
			},
			jumpToNotificationList() {
				uni.navigateTo({
					url: '/pages/always/notification/notification'
				})
			},
			jumpToAdminPanel() {
				uni.navigateTo({
					url: '/pages/admin/admin-panel/admin-panel'
				})
			},
			jumpToConversationList() {
				uni.navigateTo({
					url: '/pages/always/conversation-list/conversation-list'
				})
			},
			initUserInfo() {
				if (this.isLoadingUserInfo) {
					return
				}
				this.isLoadingUserInfo = true
				getUserInfoDetail().then(res => {
					if (res.data.hobby_label && res.data.hobby_label.length > 0) {
						res.data.hobby_label = JSON.parse(res.data.hobby_label)
					} else {
						res.data.hobby_label = []
					}
					this.userInfo = res.data
					this.selectStatus = this.userInfo.sign_status
					setUserInfo(res.data)
					if (this.mescroll) {
						this.mescroll.endSuccess(this.userInfo.length, false);
					}
					this.isLoadingUserInfo = false
				}).catch(error => {
					this.isLoadingUserInfo = false
					if (this.mescroll) {
						this.mescroll.endErr()
					}
				})
			},
			downCallback() {
				if (this.isUserLogin == false) {
					return
				}
				this.checkHasShop()
				this.initUserInfo()
				this.initAdminUnreadCountInfo()
			},
			ViewImage(e) {
				console.log(e.currentTarget.dataset.url)
				uni.previewImage({
					urls: [e.currentTarget.dataset.url],
					current: e.currentTarget.dataset.url
				});
			},
			loginAction() {
				// #ifdef MP-BAIDU
				const token = getToken()
				if (token === null || token === undefined || token.length == 0) {
					console.log('token不存在需要登陆')
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return
				}
				// #endif
				// #ifndef MP-BAIDU
				checkLogin()
				// #endif
			},
			jumpToMyActiveList() {
				uni.navigateTo({
					url: '/pages/lessuse/active-list/active-list?mode=my'
				})
			},
			jumpToPostList() {
				uni.navigateTo({
					url: '/pages/always/user-post/user-post'
				})
			},
			jumpToReplyList() {
				uni.navigateTo({
					url: '/pages/always/user-reply/user-reply'
				})
			},
			jumpToFavList() {
				uni.navigateTo({
					url: '/pages/always/user-post/user-post?isFav=1'
				})
			},
			jumpToCommentList() {
				uni.navigateTo({
					url: '/pages/always/user-comment/user-comment'
				})
			},
			editProfileAction() {
				uni.navigateTo({
					url: '/pages/always/edit-profile/edit-profile'
				})
			},
			jumpToMiniProgramList() {
				uni.navigateTo({
					url: '/pages/always/mini-program-list/mini-program-list'
				})
			},
			jumpToOfficialAccountList() {
				uni.navigateTo({
					url: '/pages/always/official-account-list/official-account-list'
				})
			},
			jumpToMyAlwaysUseThirdPart() {
				if (this.isUserLogin == false) {
					checkLogin()
					return
				}
				uni.navigateTo({
					url: '/pages/always/mini-program-list/my-use-list?isAlways=1'
				})
			},
			jumpToMyUsedThirdPart() {
				if (this.isUserLogin == false) {
					checkLogin()
					return
				}
				uni.navigateTo({
					url: '/pages/always/mini-program-list/my-use-list'
				})
			}
		},

	}
</script>

<style scoped lang="scss">
	.unread {
		top: 30upx;
		right: 50upx;
	}

	.message-card {
		display: block;
		background-color: #ffffff;
		overflow: hidden;
		border-radius: 10upx;
		margin: 30upx;
	}

	.message-card>.shadow-blur {
		overflow: initial;
	}

	.message-item {
		width: 33.3%;
		flex-direction: column;
		height: 100%;
	}

	.subscribe-item {
		width: 25%;
		flex-direction: column;
		height: 100%;
	}

	.detail-icon {
		width: 43upx;
		height: 43upx;
	}

	.detail-icon-sp {
		width: 57upx;
		height: 57upx;
	}

	.detail-icon-order {
		width: 45upx;
		height: 45upx;
	}

	.star-icon {
		width: 33upx;
		height: 33upx;
	}

	.message-item-icon-mail {
		width: 50upx;
		height: 50upx;
	}

	.message-item-icon {
		width: 60upx;
		height: 60upx;
	}

	.message-item-icon-official {
		width: 57upx;
		height: 57upx;
	}

	.wechat-item {
		width: 50%;
		height: 100%;
	}

	.header-bg {
		width: 100%;
		height: 100%;
		position: relative;
		z-index: 2;
		background-size: cover;
		background-repeat: no-repeat;
	}

	.refresh-icon {
		z-index: 99;
		position: absolute;
		width: 64upx;
		height: 64upx;
		top: -64upx;
		left: 50upx;
	}

	.unread-badge {
		border-radius: 200upx;
		font-size: 20upx;
		padding: 0upx 10upx;
		height: 28upx;
		color: #ffffff;
	}

	.publish-choose {
		position: fixed;
		width: 100%;
		bottom: 130upx;
		z-index: 99;
	}

	.info-card {
		z-index: 99;
		border-top-left-radius: 10px;
		border-top-right-radius: 10px;
		background-color: #FFF;
		position: absolute;
		top: 450upx;
		left: 0px;
		width: 100%;
		height: 450upx;

		.avatar {
			position: absolute;
			top: -60upx;
			left: 15px;
			width: 166upx;
			height: 166upx;
			padding: 2px;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: #FFF;

			.avatar-img {
				width: 100%;
				height: 100%;
			}
		}

		.name-box {
			position: absolute;
			top: 5px;
			left: 200upx;
			width: calc(100% - 210upx);
			height: 40px;
		}

		.bottom-box {
			position: absolute;
			top: 110upx;
			left: 15px;
			width: calc(100% - 20px);
			height: 80px;

			.tag-name {
				padding-left: 2px;
			}
		}
	}

	.publish-choose {
		position: fixed;
		width: 100%;
		bottom: 130upx;
		z-index: 111;
	}

	.sex-icon {
		z-index: 10;
		position: absolute;
		bottom: -8px;
		width: 18px;
		height: 18px;
	}

	.count-tag-color {
		color: #666;
	}
</style>
